package org.example.hrpc.example;

import org.example.hrpc.config.RegistryConfig;
import org.example.hrpc.config.reference.ReferenceConfig;

import java.io.IOException;

public class HelloClientRegistry {
    public static void main(String[] args) throws IOException {
        RegistryConfig registryConfig = new RegistryConfig("registry", "127.0.0.1", 2181);
        ReferenceConfig<HelloService> referenceConfig = new ReferenceConfig<>();
        referenceConfig.addRegistry(registryConfig);

        referenceConfig.setInterfaceName(HelloService.class.getName());

        referenceConfig.init();

        HelloService helloService = referenceConfig.get();
        System.out.println(helloService);
        String res = helloService.hello("World");
        System.out.println(res);
        System.in.read();
    }
}
